<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

if (!function_exists('plugin_url')) {
    function plugin_url($uri = '')
    {
        $CI     =& get_instance();
        $string = base_url("public/" . $uri);
        return $string;
    }
}
if (!function_exists('admin_css_url')) {
    function admin_css_url($uri = '', $class = '', $id = '')
    {
        $CI =& get_instance();
        if (isset($class)) {
            $class = ' class="' . $class . '"';
        }
        if (isset($id)) {
            $id = ' id="' . $id . '"';
        }
        $css_string = "<link rel='stylesheet' type='text/css' href='" . $CI->config->base_url("public/admin/css/" . $uri . '.css') . "' " . $class . " " . $id . " media='all'>";
        return $css_string;
    }
}
if (!function_exists('admin_js_url')) {
    function admin_js_url($uri = '')
    {
        $CI                =& get_instance();
        $javascript_string = '';
        if (isset($uri)) {
            $arr_f = array_unique(explode(',', preg_replace("/\.+\//", '', $uri)));
            foreach ($arr_f as $v) {
                $javascript_string .= "<script type='text/javascript' src='" . base_url("public/admin/js/" . $v . '.js') . "'></script>";
            }
        }
        return $javascript_string;
    }
}
if (!function_exists('ueditor_js_url')) {
    function kde_js_url($uri = '')
    {
        $CI                =& get_instance();
        $javascript_string = '';
        if (isset($uri)) {
            $arr_f = array_unique(explode(',', preg_replace("/\.+\//", '', $uri)));
            foreach ($arr_f as $v) {
                $javascript_string .= "<script type='text/javascript' src='" . base_url("public/admin/kindeditor/" . $v . '.js') . "'></script>";
            }
        }
        return $javascript_string;
    }
}
if (!function_exists('www_js_url')) {
    function www_js_url($uri = '')
    {
        $CI                =& get_instance();
        $javascript_string = '';
        if (isset($uri)) {
            $arr_f = array_unique(explode(',', preg_replace("/\.+\//", '', $uri)));
            foreach ($arr_f as $v) {
                $javascript_string .= "<script type='text/javascript' src='" . base_url("public/www/js/" . $v . '.js') . "'></script>";
            }
        }
        return $javascript_string;
    }
}
if (!function_exists('www_css_url')) {
    function www_css_url($uri = '', $class = '', $id = '')
    {
        $CI =& get_instance();
        if (isset($class)) {
            $class = ' class="' . $class . '"';
        }
        if (isset($id)) {
            $id = ' id="' . $id . '"';
        }
        $css_string = "<link rel='stylesheet' type='text/css' href='" . $CI->config->base_url("public/www/css/" . $uri . '.css') . "' " . $class . " " . $id . " media='all'>";
        return $css_string;
    }
}

if (!function_exists('image_url')) {
    function image_url($uri = '')
    {
        $CI =& get_instance();
        return $CI->config->base_url("public/www/image/" . $uri);
    }
}
if (!function_exists('uploader_css_url')) {
    function uploader_css_url($uri = '', $class = '', $id = '')
    {
        $CI =& get_instance();
        if (isset($class)) {
            $class = ' class="' . $class . '"';
        }
        if (isset($id)) {
            $id = ' id="' . $id . '"';
        }
        $css_string = "<link rel='stylesheet' type='text/css' href='" . $CI->config->base_url("public/admin/uploader/" . $uri . '.css') . "' " . $class . " " . $id . " media='all'>";
        return $css_string;
    }
}
if (!function_exists('uploader_js_url')) {
    function uploader_js_url($uri = '', $class = '', $id = '')
    {
        $CI                =& get_instance();
        $javascript_string = '';
        if (isset($uri)) {
            $arr_f = array_unique(explode(',', preg_replace("/\.+\//", '', $uri)));
            foreach ($arr_f as $v) {
                $javascript_string .= "<script type='text/javascript' src='" . base_url("public/admin/uploader/" . $v . '.js') . "'></script>";
            }
        }
        return $javascript_string;
    }
}